import 'package:flutter/material.dart';
import '../modular/PersonalCenter.dart';
import '../modular/RegisterFirst.dart';
import '../modular/RegisterSecond.dart';
import '../modular/RegisterThird.dart';
import '../Tabs.dart';

/*
 *命名路由传参固定写法
 */
final routes = {
  "/personalCenter": (context, {arguments}) => PersonalCenter(arguments: arguments),
  "/"              : (context) => Tabs(),
  "/registerFirst" : (context) => RegisterFirstPage(),
  "/registerSecond": (context) => RegisterSecondPage(),
  "/registerThird" : (context) => RegisterThirdPage(),
};
// ignore: strong_mode_top_level_function_literal_block
var onGenerateRoute = (RouteSettings settings) {
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
        builder: (context) =>
            pageContentBuilder(context, arguments: settings.arguments),
      );
      return route;
    } else {
      final Route route = MaterialPageRoute(
        builder: (context) => pageContentBuilder(context),
      );
      return route;
    }
  }
};
